package com.lysj.bhp.borrowing.controller;

import com.lysj.bhp.activity.domain.Activity;
import com.lysj.bhp.borrowing.base.BorrowingContent;
import com.lysj.bhp.borrowing.domain.BorrowingAccount;
import com.lysj.bhp.borrowing.vo.BorrowingWasteBookVo;
import com.lysj.bhp.util.web.ParamUtil;
import com.lysj.bhp.util.web.Resp;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: ZhangWenJian
 * @Create: 2018/8/14--16:02
 * @Description:借款流水账控制类
 */
@RestController
@RequestMapping("admin/borrowing_account")
public class BorrowingAccountController extends BorrowingContent {

    @GetMapping("/list")
    public Resp list(BorrowingAccount model){
        Specification specification = ParamUtil.createSpecification(model);
        List<BorrowingAccount> borrowingAccountList = borrowingAccountRepository.findAll(specification, new Sort(Sort.Direction.DESC, "createDate"));
        return new Resp(borrowingAccountList);
    }
}
